Import main
Import cspriteline

#rem
summary:Title Screen Class.
Used to manage and deal with all Tital Page stuff.
#End
Class TestScreen Extends Screen
	'Field background:GameImage

	Field _line:GameImage
	
	Field MouseLine:cSpriteLine
	
	Method New()
		name = "Test Screen"
	End
	
	#rem
	summary:Start Screen
	Start the Title Screen.
	#End
	Method Start:Void()
	
		Self._line = diddyGame.images.Find("red_line")
		
		For Local l:Int = 1 To 100
			Local newline:cSpriteLine = New cSpriteLine(Rnd(640),Rnd(480), Rnd(1,3))
			
		Next
		
		
		
		Self.MouseLine = New cSpriteLine(Rnd(640),Rnd(480), 2)
		
		
	End
	
	
	
	#rem
	summary:Render Title Screen
	Renders all the Screen Elements.
	#End
	Method Render:Void()
		Cls

		For Local t:cSpriteLine = EachIn SpriteLineList
			t.Draw()
		Next
		
		'If KeyDown(KEY_SPACE)
			DrawText("Lines : " + SpriteLineList.Count(), 5, 30)
			'Print("Lines : " + SpriteLineList.Count())
				If SpriteLineList.Count() >= 1
					
					Local ll:Int = 0
					
					For Local l:cSpriteLine = Eachin SpriteLineList
						ll += l.cSegmentList.Count()
					Next
					
					DrawText("Segments : " + ll, 5, 50)
					'Print("Segments : " + ll)
				Endif
		'EndIf
		
		

		
		cDrawSpriteLine(Self._line.image, 0, 0, 640, 0, 1)
		cDrawSpriteLine(Self._line.image, 0, 480, 640, 480, 1)
		
		cDrawSpriteLine(Self._line.image, 0, 0, 0, 480, 1)
		cDrawSpriteLine(Self._line.image, 640, 0, 640, 480, 1)
		
	End

	#rem
	sumary:Update Title Screen
	Will update all screen objects, handles mouse, keys
	and all use input.
	#End
	Method Update:Void()
		If MouseHit(MOUSE_LEFT) Then Local newline:cSpriteLine = New cSpriteLine(MouseX(), MouseY(), 1)
	
		For Local t:cSpriteLine = EachIn SpriteLineList
			t.Update()
		Next
		
		
	End Method

	
End